package spt.mc.demo.enums;

import java.util.ArrayList;
import java.util.List;



/**
 * API 维保类型
 * @author cb
 *
 */
public enum APIMcTypeEnum implements Enumerator{
	
	/** 1=半月保 */
	HMONTHMC(1,"半月保"),
	/** 2=季度保 */
	QUARTERMC(2,"季度保"),
	/** 3=半年保 */
	HYEARMC(3,"半年保"),
	/** 4=年度保 */
	YEARMC(4,"年度保"),
	/** 5=按需維保 */
	NEED(5,"按需維保"),
	/** 6=专项维保 */
	SPECIAL(6,"专项维保"),
	/** 9=其他 */
	OTHER(9, "其他");

	/** 枚举值 */
	private final int code;
	
	/** 枚举描述 */
	private final String message;
	
	
	private APIMcTypeEnum(int code, String message) {
		this.code = code;
		this.message = message;
	}
	
	/**
	 * @return Returns the code.
	 */
	@Override
	public int code() {
		return code;
	}
	
	/**
	 * @return Returns the message.
	 */
	@Override
	public String message() {
		return message;
	}
	
	/**
	 * 通过枚举<code>code</code>获得枚举
	 * 
	 * @param code
	 * @return EstateResultEnum
	 */
	public static APIMcTypeEnum getByCode(int code) {
		for (APIMcTypeEnum _enum : values()) {
			if (_enum.code()==code) {
				return _enum;
			}
		}
		return null;
	}
	
	/**
	 * 获取全部枚举
	 * 
	 * @return List<EstateResultEnum>
	 */
	public static List<APIMcTypeEnum> getAllEnum() {
		List<APIMcTypeEnum> list = new ArrayList<>();
		for (APIMcTypeEnum _enum : values()) {
			list.add(_enum);
		}
		return list;
	}
	
	/**
	 * 获取全部枚举值
	 * 
	 * @return List<String>
	 */
	public static List<Integer> getAllEnumCode() {
		List<Integer> list = new ArrayList<>();
		for (APIMcTypeEnum _enum : values()) {
			list.add(_enum.code());
		}
		return list;
	}
}
